package cn.cjp.m3d27;

public class hVarArgs {
    public static void main(String[] args) {
        System.out.println(add());
        System.out.println(add(1,2,4));
    }

    //可变参数
    public static int add(int ... arr){
        int sum = 0;
        for (int i = 0; i <arr.length ; i++) {
            sum = sum +arr[i];
        }
        return sum;
    }

    public static void add1(String str,int ... arr){
    }

    public static void method(Object ... objects){

    }
}
